package com.itheima.a01_ApplicationContext比BeanFactory多点啥;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * 事件发布与监听
 * 监听
 */
@Component
public class Component2 {

    private static final Logger log = LoggerFactory.getLogger(Component2.class);

    /**
     * 监听
     * classes:指定哪个发布事件
     */
    @EventListener(classes = UserRegisteredEvent.class)
    public void aaa(UserRegisteredEvent event) {
        log.debug("{}", event);
        log.debug("发送短信");
    }
}
